package cn.cdeden.knowledge.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

@Getter
@AllArgsConstructor
public enum SysParametersConfigEnums {
    SYS_GENERAL_CONFIG("sys_general_config","系统通用配置"),
    SYS_LOGIN_CONFIG("sys_login_config","系统登录配置"),

    SYS_SERVICE_CONFIG("sys_service_config","系统服务配置"),

    SYS_FILE_CONFIG("sys_file_config","系统文件配置"),
    SYS_INTEGRATION_CONFIG("sys_integration_config","系统集成配置"),

    SYS_EXTERNAL_CONFIG("sys_external_config","系统外部系统"),

    ;


    private final String code;
    private final String name;


    public static SysParametersConfigEnums find(String type) {
        for (SysParametersConfigEnums value : SysParametersConfigEnums.values()) {
            if (StringUtils.equalsIgnoreCase(type,value.getCode())) {
                return value;
            }
        }
        return null;
    }
    public static String[] find() {
        List<String> list = new ArrayList<>();
        for (SysParametersConfigEnums value : SysParametersConfigEnums.values()) {
            list.add(value.getCode());
        }


        String[] strings = list.toArray(new String[0]);

        return strings;
    }
}
